/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.eclipse.iota;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.iota.model.Addition;
import org.eclipse.iota.model.Alternation;
import org.eclipse.iota.model.Clause;
import org.eclipse.iota.model.Constant;
import org.eclipse.iota.model.Division;
import org.eclipse.iota.model.Equation;
import org.eclipse.iota.model.EquationType;
import org.eclipse.iota.model.Existential;
import org.eclipse.iota.model.Exponentiation;
import org.eclipse.iota.model.Inclusion;
import org.eclipse.iota.model.LinearCombination;
import org.eclipse.iota.model.LinearExpression;
import org.eclipse.iota.model.Module;
import org.eclipse.iota.model.Multiplication;
import org.eclipse.iota.model.Negation;
import org.eclipse.iota.model.Parameter;
import org.eclipse.iota.model.Polynom;
import org.eclipse.iota.model.Proof;
import org.eclipse.iota.model.Property;
import org.eclipse.iota.model.Reference;
import org.eclipse.iota.model.Sequent;
import org.eclipse.iota.model.Step;
import org.eclipse.iota.rewrite.IotaRule;
import org.eclipse.iota.rewrite.IotaRuleManager;

/**
 * <!-- begin-user-doc -->
 * The <b>Factory</b> for the model.
 * It provides a create method for each non-abstract class of the model.
 * <!-- end-user-doc -->
 * @see org.eclipse.iota.IotaPackage
 * @generated
 */
public class IotaFactory extends EFactoryImpl {
	
	/**
	 * The singleton instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final IotaFactory eINSTANCE = init();

	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static IotaFactory init() {
		try {
			IotaFactory theIotaFactory = (IotaFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/iota"); 
			if (theIotaFactory != null) {
				return theIotaFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new IotaFactory();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IotaFactory() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case IotaPackage.MODULE: return createModule();
			case IotaPackage.PROPERTY: return createProperty();
			case IotaPackage.ALTERNATION: return createAlternation();
			case IotaPackage.CLAUSE: return createClause();
			case IotaPackage.BOOLEAN: return createBoolean();
			case IotaPackage.INCLUSION: return createInclusion();
			case IotaPackage.EQUATION: return createEquation();
			case IotaPackage.PARAMETER: return createParameter();
			case IotaPackage.EXISTENTIAL: return createExistential();
			case IotaPackage.CONSTANT: return createConstant();
			case IotaPackage.REFERENCE: return createReference();
			case IotaPackage.ADDITION: return createAddition();
			case IotaPackage.MULTIPLICATION: return createMultiplication();
			case IotaPackage.NEGATION: return createNegation();
			case IotaPackage.DIVISION: return createDivision();
			case IotaPackage.EXPONENTIATION: return createExponentiation();
			case IotaPackage.LINEAR_EXPRESSION: return createLinearExpression();
			case IotaPackage.LINEAR_COMBINATION: return createLinearCombination();
			case IotaPackage.POLYNOM: return createPolynom();
			case IotaPackage.SEQUENT: return createSequent();
			case IotaPackage.PROOF: return createProof();
			case IotaPackage.STEP: return createStep();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case IotaPackage.EQUATION_TYPE:
				return createEquationTypeFromString(eDataType, initialValue);
			case IotaPackage.IOTA_RULE:
				return createIotaRuleFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case IotaPackage.EQUATION_TYPE:
				return convertEquationTypeToString(eDataType, instanceValue);
			case IotaPackage.IOTA_RULE:
				return convertIotaRuleToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Module createModule() {
		Module module = new Module(){};
		return module;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Property createProperty() {
		Property property = new Property(){};
		return property;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Sequent createSequent() {
		Sequent sequent = new Sequent(){};
		return sequent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Alternation createAlternation() {
		Alternation alternation = new Alternation(){};
		return alternation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Proof createProof() {
		Proof proof = new Proof(){};
		return proof;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Step createStep() {
		Step step = new Step(){};
		return step;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Clause createClause() {
		Clause clause = new Clause(){};
		return clause;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public org.eclipse.iota.model.Boolean createBoolean() {
		org.eclipse.iota.model.Boolean boolean_ = new org.eclipse.iota.model.Boolean(){};
		return boolean_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Inclusion createInclusion() {
		Inclusion inclusion = new Inclusion(){};
		return inclusion;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Equation createEquation() {
		Equation equation = new Equation(){};
		return equation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Parameter createParameter() {
		Parameter parameter = new Parameter(){};
		return parameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Existential createExistential() {
		Existential existential = new Existential(){};
		return existential;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Constant createConstant() {
		Constant constant = new Constant(){};
		return constant;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Reference createReference() {
		Reference reference = new Reference(){};
		return reference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Addition createAddition() {
		Addition addition = new Addition(){};
		return addition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Multiplication createMultiplication() {
		Multiplication multiplication = new Multiplication(){};
		return multiplication;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Negation createNegation() {
		Negation negation = new Negation(){};
		return negation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Division createDivision() {
		Division division = new Division(){};
		return division;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Exponentiation createExponentiation() {
		Exponentiation exponentiation = new Exponentiation(){};
		return exponentiation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinearCombination createLinearCombination() {
		LinearCombination linearCombination = new LinearCombination(){};
		return linearCombination;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Polynom createPolynom() {
		Polynom polynom = new Polynom(){};
		return polynom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinearExpression createLinearExpression() {
		LinearExpression linearExpression = new LinearExpression(){};
		return linearExpression;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EquationType createEquationTypeFromString(EDataType eDataType, String initialValue) {
		EquationType result = EquationType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertEquationTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * Create a IotaRule instance based on its name.
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public IotaRule createIotaRuleFromString(EDataType eDataType, String name) {
		return IotaRuleManager.INSTANCE.getRule(name);
	}

	/**
	 * <!-- begin-user-doc -->
	 * Convert a IotaRule to its string representation (its name).
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public String convertIotaRuleToString(EDataType eDataType, Object rule) {
		return ((IotaRule) rule).getName();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IotaPackage getIotaPackage() {
		return (IotaPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static IotaPackage getPackage() {
		return IotaPackage.eINSTANCE;
	}

} //IotaFactory
